Previous Page TOC Next Page




- 10 -
Graphics NT Style


Displaying information on-screen has gone from black art—to known quantity—back to black art again. It doesn't seem to matter how many standards there are; displaying an image on-screen is still an unquantifiable entity in the Windows environment. The biggest reason for this, of course, is the wide variety of applications that a user runs. Someone that uses CAD or other heavy graphics applications all day won't be happy with the performance provided by a standard display adapter.

Applications aren't the only problem. Sometimes, it's a matter of user perception. Someone with poor eyesight will want a large monitor with a high refresh rate—anything less won't do the job. Likewise, someone such as a programmer with a lot of data to display will want a high resolution setup that provides maximum flexibility when it comes to character size.

Even environmental factors come into play. Have you ever seen a display that seems to flicker a great deal when used with fluorescent lighting? The problem might not even be with the computer, the video adapter, or the monitor. It might simply be a sign of a bad ballast, a light bulb that's failing, or some other situation beyond the control of the person using the computer.

The first step in understanding what's going on with your display is knowing how Windows displays data. It also helps to know the kinds of graphics standards and what types of things you should look for when buying your equipment. This chapter addresses all three of those areas.



Looking Ahead: I'll cover a variety of user-related, graphics subjects in the book as well. Look in Chapter 14, "Exploiting Your Hardware," if you want to know how to install a video adapter or monitor. You can find out about fonts in Chapter 15, "Fonts and Printing;" it's a printer-oriented chapter, but fonts affect your display as well. If you work with multimedia, look in Chapter 16, "Multimedia Under Windows NT," to see how multimedia support in Windows NT will affect your display. Finally, for those times when your display isn't cooperating with you, look in Chapter 25, "Hardware Problems," for troubleshooting information.


The Windows NT Graphics Architecture


Video is the most noticeable architectural component of Windows. It's the underlying combination of hardware and software that enables you to see the graphics, dialog boxes, icons, and other elements that make Windows worth using. Under DOS, text and graphics were separate elements and used different video adapter display modes for the most part. Windows displays everything in graphics mode, so it would seem that the problem would be simpler, not more complex. The truth is a lot different from what most people expect. That dialog box is an object, not simply a picture. An object has properties and it maintains its separate identity. When Windows draws a dialog box, it's building the representation of a screen object—not drawing a picture. The same holds true for all the other graphics you see on-screen. The GDI (graphics device interface) is ultimately responsible for managing all these graphic components that a programmer uses to create the application you use every day.

I begin with a look at the three elements that I consider crucial to an understanding of the GDI architecture. You need to consider inter-component communications (a statement of video display problems and interfaces), current standards used to create the GDI (methods used to define solutions to various display problems and a description of the interfaces), and the GDI itself (the implementation of the standards). I'll look at two of these areas in the following sections. (I consider standards so important that I placed them in a separate section.) You should have a good understanding of what the GDI does by the time you're through.

Communication Is Key


Inter-component communication is key to making the Windows GDI work properly. The problem isn't simply one of displaying a picture on-screen; that would be easy to manage. The problem is one of communicating between the various elements that create and manage the picture in the first place. You need to remember that the GDI has a lot more to worry about than your application—or even all the Windows applications running on a machine for that matter. The GDI has to manage every application that Windows is running, no matter what environment that application is running in. That includes both DOS and Windows applications for Windows 95. Windows NT has even more to manage because it also provides OS/2 and POSIX operating environments. The following list illustrates some of the Windows communication problems.

Now that you have a better idea of the communication problems that Windows suffers from, you might wonder why it works at all. Windows uses something called a message loop to talk with an application; each Windows NT session has its own message loop and there is one loop for the system itself. It's this series of message (event) loops that enable every application running within Windows to communicate with each other and Windows itself. In addition, Windows doesn't allow an application to draw to the real display buffer. It actually draws to a virtual buffer. When you switch from one environment to another—say Windows to DOS—Windows takes away one virtual screen and replaces it with another. The combination of an event loop and constant redrawing enables Windows to keep your display up-to-date, even if small amounts of miscommunication do occur.

The Windows NT Graphics Architecture


Now that you have some idea of the problems that Microsoft (and any other vendor) faces when it comes to providing something for you to look at, it's time to discuss how they do it. Display adapters and monitors have both moved beyond the simpler requirements of the time when IBM was at the helm. In the interim, we've seen the emergence of even higher resolutions and a new adapter called the XGA. The SVGA is also improving on an almost daily basis. It used to be that 640x480 resolution and 256 colors were something to whistle about. Today, an adapter is considered almost inadequate at 1024x768 resolution and 24-bit (16.7 million) colors. Windows NT endeavors to handle this wide range of capabilities using the same centralized control mechanism that it uses for printing—a combination of the minidriver and device independent bitmap (DIB) engine.

One of the main architectural components is the GDI. This is the part of the graphics architecture that your application will interact with. The GDI has been tuned and returned throughout the various incarnations of Windows. It's no surprise that Microsoft has spent so much time in this area because many benchmark tests focus on graphics performance. In fact, what users notice most is the way the graphics engine performs. Microsoft did some more tuning of the GDI for Windows NT, but I'd term this tuning more incremental than major. The following list provides details on some of the more significant changes.



Note: The Windows NT GDI has an interesting feature: It's one of the few pieces that Microsoft wrote mostly with C++. (The rest of Windows NT uses a combination of C and C++.) Why would Microsoft take this step? In my opinion, the reason is two-fold. First, using C++ would allow them to make full use of the Microsoft Foundation Class (MFC) support built into C++. Second, using objects instead of procedural code would tend to make the GDI easier to maintain (especially in a multi-platform environment like Windows NT).

Improvements in the GDI aren't the only change in Windows NT, which features some pretty big architectural changes as well. Take a look at the overall architecture. I won't get into bits and bytes here, but I will tell you about the basic components required to display something on-screen. Figure 10.1 is an overview of the Windows NT architecture. The following list tells you what task each of the components performs.

Figure 10.1. An overview of the Windows NT graphics architecture.

Keep in mind that this was a quick tour of the video subsystem. The actual inner workings of this part of Windows are a lot more complex than you might think. To give you a better idea of the way things work, think of Windows as having three video paths (it's more complex than that, but don't get mired in too much detail at this point): one 16-bit DOS, one 16-bit Windows, and one 32-bit Windows. The path that Windows uses depends on what applications you're using, the type of adapter you have, and the video performance settings you select in the System Properties dialog box. The 16-bit DOS path consists of the VDD, display adapter, and video memory. It also might include VFLATD.VXD if required. The 16-bit Windows path adds WINOLDAP, the screen grabber, User, and the GDI. The 32-bit path includes User, the GDI, the display minidriver, the DIB engine, and video memory. It also includes VFLATD.VXD if your display adapter uses bank-switched memory. Both Windows paths could include the ICM and the associated color profiles. It depends on your setup, the drivers that Microsoft eventually includes, and the capabilities of the devices you're using.

Graphics Standards


The third major part of our GDI architecture triad is standards; I think that standards are so important that I placed them in a separate section. You should think about standards as a very important part of any graphics decision you make. Many different standards organizations help keep things running smoothly on your computer. Several competing standards affect how your modem works. One of these organizations, the CCITT, has become a major contributor as of late. Another organization, EIA, defines specifications for the various port connectors, serial and parallel, that attach your machine to the outside world and peripheral devices. The standards organization you want to watch for display adapters and monitors, though, is the Video Electronics Standards Association (VESA). This organization does a lot more than simply define the electronics behind a monitor or display adapter; it also defines the programming interface. When IBM wouldn't publish the specifications for the 8514/A display adapter, for example, VESA got together with several other companies and published one in IBM's stead. When someone creates a device driver for Windows, it's the VESA standards that they use when designing the hardware interface section of the code. Your application indirectly interacts with that driver through the GDI. When you ask Windows to tell you the capabilities of a particular device, it can do so because the display adapter and its driver use a standard interface that Windows can understand.



Tip: VESA can provide you with detailed specifications for a number of display adapter and monitor standards. You can usually get copies of these standards from online sources such as CompuServe. They also often appear in the manuals that come with your adapter or monitor. You can contact VESA directly using the following information:

Video Electronics Standards Association
2150 North First Street, Suite 440
San Jose, CA 95131-2029
Voice: (408) 435-0333
Fax: (408) 435-8225


I first discovered VESA in 1989, but it was probably around a while before that. IBM had dropped VGA in favor of its proprietary 8514/A display adapter. Without a leader in the field to dictate a standard, the entire display adapter arena fell into a state of disarray. At the time I first heard about VESA, it was working on a standard to fix the SVGA problem. Of course, the resolutions and number of colors were severely limited in comparison with what you can get today.

The main difficulty facing the graphics community was communication. Before this time, every display adapter used the same programming interface, in the form of a BIOS call, to change display settings and otherwise control the display adapter. All the old display methods worked, but vendors chose to differentiate their products by implementing the VGA "extended" modes differently. The resulting chaos made it impossible for any programmer to write an application that used SVGA modes without writing a different driver for each adapter.

VESA stepped in to make sense of all this chaos. The result of its initial efforts were several VESA standards and some additional software for each display adapter. That VESA driver that you load for some applications is actually a BIOS extension that enables display adapters to use a standardized SVGA interface. The extension translates VESA standard BIOS calls into something adapter specific. As a result, an application can use one set of BIOS calls to configure and control the display adapter. Newer display adapters no longer require you to load a special driver; their BIOS chips come with VESA support installed. Table 10.1 shows many of the common standards that VESA has produced. The older standards also shed some light on some issues that these newer standards don't cover. A representative at VESA would be more than happy to answer any questions you might have.

Table 10.1. VESA standards for display adapters and monitors.

Standard Title Purpose
VS911020 Super VGA protected-mode interface This document provides information on a standardized method of accessing the BIOS routines from a protected-mode program.
VS911021 Video cursor interface Use this standard to learn how to build an interface between a pointing device and the display adapter.
VS911022 Super VGA BIOS extension This is the document you'll need to learn about VESA standard display modes for the SVGA.
VXE 1.0 XGA extensions standard This document tells you about some of the standardization efforts underway for the XGA.
VS910810 Monitor timing standard for 1024x768 with 70Hz refresh rate This standard helped provide a consistent method of providing ergonomically correct displays. It enables a vendor to create a display adapter and monitor that will work together at the 70Hz refresh rate, which greatly reduces eyestrain.
VS900601 Standard 8514/A register bit fields A programmer needs to know the details of how a register works. This standard provides that information.
VS890803 Standard VGA passthrough connector This standard came out of the confusion about to how to get a high-resolution display adapter to work with a standard one. The passthrough connector seemed an ideal way to do it, but the connections for it weren't standardized. This standard defines the passthrough connector and enables you to use multiple adapters in one machine.
VS890804 Standard 8514/A registers Before you can program a register, you need to know what to call it. This standard defines what registers an 8514/A contains. Remember that IBM didn't want to share this information with anyone.

Of course, this selection of standards is by no means complete. VESA works on a whole array of other standardization efforts, such as industrial guidelines for the manufacture of computer components. Its most famous nondisplay-related standard is probably the VL bus. This was such an important standard at one time that in 1993, Dell wanted to take VESA to court over the matter of who owned the standard.

Video Boards


While I have your attention focused on the complexities of the video subsystem, take a quick look at video boards. You might have missed a few performance clues tucked away in the discussion of architecture. Did you notice that VFLATD.VXD supports only a 1MB address space? What happens if your display adapter contains 2MB or more of memory? Don't worry. Windows NT will completely support the entire range of memory provided by your display adapter. It might have to rely on the display minidriver more to do it, though. This means a lot more calls and perhaps a few more thunks between various display components. The end result is a slight loss in performance from a purely display subsystem point of view.

It's not all bad news, of course. You'll gain from having more video memory in several ways. First, more memory means more colors. A higher number of colors could result in better font anti-aliasing and other aesthetic qualities of your display. Second, more memory means higher resolution. A higher level of resolution could help you position graphic elements more accurately and result in reduced eye fatigue.

No matter which way you look at it, though, more colors and high resolution spell decreased performance. Moving the video window around takes a little time; allowing the frame buffer to manage more than 1MB of video memory takes even more. Each layer of management that you add to the video subsystem will chew up processor cycles. How do you get around these problems?



Tip: Look through the list of devices that Windows NT supports with native drivers before you buy a new display adapter. The hand-tuned Microsoft drivers will almost always work better than those you get from the vendor because they are tested more extensively. They will definitely work better than the 16-bit drivers that some older display adapters come with. Buying a new adapter that sports a Windows NT logo (or in most cases, the Windows 95 logo) will probably cost you more but won't buy you that much, other than a label. Looking through the supported hardware list will probably net you a great display adapter at lower prices yet retain all the capabilities that Windows NT provides.

Windows 95 does provide a few things that Windows NT doesn't. One of the biggest problems is that Windows NT won't support Plug and Play—a major feature of Windows 95. You could gain a lot from having both a Plug and Play-compatible monitor and display adapter. Not only are these devices self configuring, but they allow a greater level of flexibility as well.



Peter's Principle: More Than Enough Graphics

You'll probably be very tempted to go out and buy the first display adapter that offers 16.7 million colors and 2,048x2,048 resolution. That might be a good way to build for the future, but it might be a little too much for today unless you're an artist or you work in a graphics-oriented field. Go ahead and get the tomorrow solution today; that only makes sense from a financial perspective. After you do get a high-performance display, however, think about the way you'll actually use it. In most cases, a 256-color display provides more than enough color. A 17-inch monitor supports a resolution of 768x1,024 just fine, too. Once you start going beyond this color and resolution level, your machine will take a performance hit because of the way Windows NT handles video memory.

Using the higher level of display capability is fine if you don't mind giving up performance as well. I'd rather squeeze every ounce of performance from my machine and use settings that are more in line with what I can actually use. Of course, that shouldn't stop you from getting a high-performance display adapter, but it should change the way you configure it. Always consider when you have "enough" graphics to meet the need.



On Your Own


Check your SYSTEM folder and see if you can find all the files that make up the graphics subsystem. Use the graphics subsystem discussion in this chapter as the basis for your search.

Try looking through the documentation for your monitor and video adapter. Which graphics standards does your equipment adhere to? It always helps to know where to find this kind of information before you got to a store to buy new equipment. Never take the salesperson's word for what a piece of equipment can do; verify that it meets the standards required to get the job done.

A variety of manufacturers now produce 3D video boards—video adapters that are specially designed to provide better performance when used with a CAD or other graphics application. Try to find a computer store display that has a standard graphics and a 3D graphics machine side-by-side. How does the 3D adapter perform in comparison to the standard video adapter? Why do you think that you either see or don't see an improvement in performance? (Hint: Many of these 3D video adapters do indeed provide better performance with CAD programs specially designed to use their extended command set. Windows isn't a CAD application so it won't use this command set as a default. Some vendors see this as a potential problem and add other features to their 3D video adapters to give them a performance boost when used with standard applications.)

Previous Page Page Top TOC Next Page